I may be covering how to adapt frames

Load Libraries

library(moveVis)
## Warning: package 'moveVis' was built under R version 4.2.3
## Find a collection of moveVis animations created by other users on
## Twitter: https://twitter.com/schwalbwillmann
library(move)
## Warning: package 'move' was built under R version 4.2.3
## Loading required package: geosphere
## Warning: package 'geosphere' was built under R version 4.2.3
## Loading required package: sp
## Loading required package: raster
## Loading required package: rgdal
## Warning: package 'rgdal' was built under R version 4.2.3
## Please note that rgdal will be retired during 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## See https://r-spatial.org/r/2022/04/12/evolution.html and https://github.com/r-spatial/evolution
## rgdal: version: 1.6-5, (SVN revision 1199)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.5.2, released 2022/09/02
## Path to GDAL shared files: C:/Users/mhein/AppData/Local/R/win-library/4.2/sf/gdal
## GDAL binary built with GEOS: TRUE 
## Loaded PROJ runtime: Rel. 8.2.1, January 1st, 2022, [PJ_VERSION: 821]
## Path to PROJ shared files: C:/Users/mhein/AppData/Local/R/win-library/4.2/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:1.6-0
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
library(raster)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.0     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.1     ✔ tibble    3.1.8
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ tidyr::extract() masks raster::extract()
## ✖ dplyr::filter()  masks stats::filter()
## ✖ dplyr::lag()     masks stats::lag()
## ✖ dplyr::select()  masks raster::select()
## ℹ Use the ]8;;http://conflicted.r-lib.org/conflicted package]8;; to force all conflicts to become errors
library(ggplot2)
library(here)
## here() starts at C:/Users/mhein/OneDrive/Desktop/Computer Modeling R Programs/Computer_Modeling_Group_Project/Group_2_Rayshader
library(tidytuesdayR)
library(lubridate)
library(janitor)
## 
## Attaching package: 'janitor'
## 
## The following object is masked from 'package:raster':
## 
##     crosstab
## 
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(dplyr)
library(kableExtra)
## 
## Attaching package: 'kableExtra'
## 
## The following object is masked from 'package:dplyr':
## 
##     group_rows
library(maps)
## 
## Attaching package: 'maps'
## 
## The following object is masked from 'package:purrr':
## 
##     map
library(mapdata)
library(mapproj)

Load Data

tuesdata <- tidytuesdayR::tt_load(2023, week = 5)
## --- Compiling #TidyTuesday Information for 2023-01-31 ----
## --- There are 2 files available ---
## --- Starting Download ---
## 
##  Downloading file 1 of 2: `cats_uk.csv`
##  Downloading file 2 of 2: `cats_uk_reference.csv`
## --- Download complete ---
cats_uk <- as.data.frame(tuesdata$cats_uk) %>% 
  mutate( timestamp = ymd_hms(timestamp)) %>% 
  filter(tag_id %in% c("Athena","Ares", "Lola"))

cats_uk_reference <- tuesdata$cats_uk_reference

# use cats_uk
glimpse(cats_uk)
## Rows: 433
## Columns: 11
## $ tag_id                   <chr> "Ares", "Ares", "Ares", "Ares", "Ares", "Ares…
## $ event_id                 <dbl> 3395610551, 3395610552, 3395610553, 339561055…
## $ visible                  <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRU…
## $ timestamp                <dttm> 2017-06-24 01:03:57, 2017-06-24 01:11:20, 20…
## $ location_long            <dbl> -5.113851, -5.113851, -5.113730, -5.113774, -…
## $ location_lat             <dbl> 50.17032, 50.17032, 50.16988, 50.16983, 50.17…
## $ ground_speed             <dbl> 684, 936, 2340, 0, 4896, 504, 108, 504, 252, …
## $ height_above_ellipsoid   <dbl> 154.67, 154.67, 81.35, 67.82, 118.03, 123.07,…
## $ algorithm_marked_outlier <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
## $ manually_marked_outlier  <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
## $ study_name               <chr> "Pet Cats United Kingdom", "Pet Cats United K…

Clean data

cats_uk <- read_csv("https://www.datarepository.movebank.org/bitstream/handle/10255/move.883/Pet%20Cats%20United%20Kingdom.csv?sequence=3") %>%
  clean_names() %>%
  # Standardize things and reorder columns.
  select(tag_id = tag_local_identifier,
         event_id:location_lat,
         ground_speed,
         height_above_ellipsoid,
         algorithm_marked_outlier,
         manually_marked_outlier,
         study_name) %>%
  # Explicitly encode FALSE in the outlier columns.
  tidyr::replace_na(list(algorithm_marked_outlier = FALSE,
                         manually_marked_outlier = FALSE)) %>%
  # filter to have subset of data
  filter(tag_id %in% c("Athena","Ares","Lola"))
## Rows: 18215 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (5): sensor-type, individual-taxon-canonical-name, tag-local-identifier...
## dbl  (5): event-id, location-long, location-lat, ground-speed, height-above-...
## lgl  (3): visible, algorithm-marked-outlier, manually-marked-outlier
## dttm (1): timestamp
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
glimpse(cats_uk)
## Rows: 433
## Columns: 11
## $ tag_id                   <chr> "Ares", "Ares", "Ares", "Ares", "Ares", "Ares…
## $ event_id                 <dbl> 3395610551, 3395610552, 3395610553, 339561055…
## $ visible                  <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRU…
## $ timestamp                <dttm> 2017-06-24 01:03:57, 2017-06-24 01:11:20, 20…
## $ location_long            <dbl> -5.113851, -5.113851, -5.113730, -5.113774, -…
## $ location_lat             <dbl> 50.17032, 50.17032, 50.16988, 50.16983, 50.17…
## $ ground_speed             <dbl> 684, 936, 2340, 0, 4896, 504, 108, 504, 252, …
## $ height_above_ellipsoid   <dbl> 154.67, 154.67, 81.35, 67.82, 118.03, 123.07,…
## $ algorithm_marked_outlier <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
## $ manually_marked_outlier  <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
## $ study_name               <chr> "Pet Cats United Kingdom", "Pet Cats United K…
glimpse(cats_uk_reference)
## Rows: 101
## Columns: 16
## $ tag_id                        <chr> "Tommy-Tag", "Athena", "Ares", "Lola", "…
## $ animal_id                     <chr> "Tommy", "Athena", "Ares", "Lola", "Mave…
## $ animal_taxon                  <chr> "Felis catus", "Felis catus", "Felis cat…
## $ deploy_on_date                <dttm> 2017-06-03 01:02:09, 2017-06-24 01:02:1…
## $ deploy_off_date               <dttm> 2017-06-10 02:10:52, 2017-06-30 23:59:3…
## $ hunt                          <lgl> TRUE, TRUE, NA, TRUE, TRUE, TRUE, TRUE, …
## $ prey_p_month                  <dbl> 12.5, 3.0, 0.0, 3.0, 3.0, 3.0, 3.0, 17.5…
## $ animal_reproductive_condition <chr> "Neutered", "Spayed", "Neutered", "Spaye…
## $ animal_sex                    <chr> "m", "f", "m", "f", "m", "f", "m", "m", …
## $ hrs_indoors                   <dbl> 12.5, 7.5, 7.5, 17.5, 12.5, 12.5, 12.5, …
## $ n_cats                        <dbl> 2, 2, 2, 1, 1, 2, 3, 4, 2, 2, 1, 1, 1, 2…
## $ food_dry                      <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE…
## $ food_wet                      <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE…
## $ food_other                    <lgl> FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, …
## $ study_site                    <chr> "UK", "UK", "UK", "UK", "UK", "UK", "UK"…
## $ age_years                     <dbl> 11, 3, 3, 10, 7, 7, 6, 2, 4, 4, 8, 1, 8,…

Data Analysis

data("whitestork_data")

view(df)

m <- align_move(m, # This function filters to have consistent time scale so function frames_spatial
                res = 180, # change interval to every 30 min if 90; Can be "max" or "min" or "mean" for the average resolution
                digit = 0, # changes time interval in seconds
                unit = "mins")

view(m)

# df2move() #converts data.frame to move or movestack (data type needed) to add into :
# frames_spatial() OR frames_graph()

frames <- frames_spatial(m, # take move data
                         trace_show = TRUE,
                         equidistant = FALSE,
                         map_service = "osm", # select map
                         map_type = "terrain_bg")
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 19.8s at 25 fps for 495 frames
## Retrieving and compositing basemap imagery...
## Warning in CPL_crs_from_input(x): GDAL Message 1: +init=epsg:XXXX syntax is
## deprecated. It might return a CRS with a non-EPSG compliant axis order.
## Assigning raster maps to frames...
## Creating frames...
frames[[200]] # plots a single frame

frames <- frames %>%
  add_labels(title = "White Storks (Ciconia ciconia) Migration 2018",
             caption = "Trajectory data: Cheng et al. (2019); Fiedler et al. (2013-2019), https://doi.org/10.5441/001/1.ck04mn78 Map: OpenStreetMap/Stamen; Projection: Geographic, WGS84",
             x = "Longitude",
             y = "Latitude") %>%
  add_timestamps(type = "label") %>% # can be "label" or "text"
  add_progress(colour = "white") %>%
  add_northarrow(colour = "white", position = "bottomleft") %>%
  add_scalebar(colour = "black", position = "bottomright", distance = 600)

frames[[200]] # plots a single frame

animate_frames(frames = frames, out_file = here("Mac","output","stork.gif"))
## Rendering animation...
## Approximated animation duration: ≈ 19.8s at 25 fps for 495 frames
# cats_uk %>% filter(tag_id %in% c("Athena","Ares", "Lola"))
# data need: tag_id - identifier
#          : x & y (i.e. Lat/long)
#          : time - make regular interval via 

# make df to move or movestack data

cats_uk <- cats_uk[!duplicated(cats_uk$timestamp),] # remove duplicate time stamp
test <- df2move(cats_uk,  #df
                proj = "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0",  # type of projection
                x = "location_long",  # what are your x coord
                y = "location_lat",
                time = "timestamp", #what are the time, needs to be POSIXct
                track_id = "tag_id")

# align move to have same interval

m <- align_move(test, res = "mean", unit = "secs")
glimpse(m)
## Formal class 'MoveStack' [package "move"] with 17 slots
##   ..@ trackId                : Factor w/ 3 levels "Ares","Athena",..: 1 1 1 1 1 1 1 1 1 1 ...
##   ..@ timestamps             : POSIXct[1:312], format: "2017-06-24 02:34:51" "2017-06-24 04:07:42" ...
##   .. ..- attr(*, "names")="Ares1" "Ares2" ...
##   ..@ idData                 :'data.frame':  3 obs. of  0 variables
##   ..@ sensor                 : Factor w/ 2 levels "unknown","interpolateTime": 2 2 2 2 2 2 2 2 2 2 ...
##   .. ..- attr(*, "names")= chr [1:312] "Ares1" "Ares2" "Ares3" "Ares4" ...
##   ..@ data                   :'data.frame':  312 obs. of  3 variables:
##   .. ..$ x   : num [1:312] -5.11 -5.11 -5.11 -5.11 -5.11 ...
##   .. ..$ y   : num [1:312] 50.2 50.2 50.2 50.2 50.2 ...
##   .. ..$ time: POSIXct[1:312], format: "2017-06-24 02:34:51" "2017-06-24 04:07:42" ...
##   ..@ coords.nrs             : num(0) 
##   ..@ coords                 : num [1:312, 1:2] -5.11 -5.11 -5.11 -5.11 -5.11 ...
##   .. ..- attr(*, "dimnames")=List of 2
##   ..@ bbox                   : num [1:2, 1:2] -5.12 50.14 -5.07 50.17
##   .. ..- attr(*, "dimnames")=List of 2
##   ..@ proj4string            :Formal class 'CRS' [package "sp"] with 1 slot
##   ..@ trackIdUnUsedRecords   : Factor w/ 3 levels "Ares","Athena",..: 
##   ..@ timestampsUnUsedRecords: NULL
##   ..@ sensorUnUsedRecords    : Factor w/ 2 levels "unknown","interpolateTime": 
##   ..@ dataUnUsedRecords      :'data.frame':  0 obs. of  0 variables
##   ..@ dateCreation           : POSIXct[1:1], format: "2023-03-25 21:21:29"
##   ..@ study                  : chr(0) 
##   ..@ citation               : chr(0) 
##   ..@ license                : chr(0)
get_maptypes()
## $osm
##  [1] "streets"      "streets_de"   "streets_fr"   "humanitarian" "topographic" 
##  [6] "roads"        "hydda"        "hydda_base"   "hike"         "grayscale"   
## [11] "no_labels"    "watercolor"   "toner"        "toner_bg"     "toner_lite"  
## [16] "terrain"      "terrain_bg"   "mtb"         
## 
## $carto
##  [1] "light"                "light_no_labels"      "light_only_labels"   
##  [4] "dark"                 "dark_no_labels"       "dark_only_labels"    
##  [7] "voyager"              "voyager_no_labels"    "voyager_only_labels" 
## [10] "voyager_labels_under"
## 
## $mapbox
##  [1] "satellite"     "streets"       "streets_basic" "hybrid"       
##  [5] "light"         "dark"          "high_contrast" "outdoors"     
##  [9] "hike"          "wheatpaste"    "pencil"        "comic"        
## [13] "pirates"       "emerald"
make_frames <- frames_spatial(m,
                          trace_show = TRUE, # show trace of complete path
                         equidistant = FALSE, # make map squared? FALSE= prevent stretching of map
                         map_service = "osm",   # select map type use ?get_maptypes
                         map_type = "mtb")
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 4.28s at 25 fps for 107 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
frames_aes <- make_frames %>% 
  add_timestamps(type = "label") %>%  # show the timestamps
  add_progress(colour = "white") %>% # add a progress bar
  add_northarrow(colour = "white", position = "bottomleft") %>% 
  add_scalebar(colour = "black", position = "bottomright", distance = 600)

# check a single frame
make_frames[[100]]

animate_frames(frames = frames_aes, out_file = here("Mac","output","cattest2.gif"))
## Rendering animation...
## Approximated animation duration: ≈ 4.28s at 25 fps for 107 frames
cats_uk <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-01-31/cats_uk.csv')
## Rows: 18215 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (2): tag_id, study_name
## dbl  (5): event_id, location_long, location_lat, ground_speed, height_above_...
## lgl  (3): visible, algorithm_marked_outlier, manually_marked_outlier
## dttm (1): timestamp
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
cats_uk_reference <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-01-31/cats_uk_reference.csv')
## Rows: 101 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (6): tag_id, animal_id, animal_taxon, animal_reproductive_condition, an...
## dbl  (4): prey_p_month, hrs_indoors, n_cats, age_years
## lgl  (4): hunt, food_dry, food_wet, food_other
## dttm (2): deploy_on_date, deploy_off_date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
UK <- map_data("world", region = "UK")

ggplot()+
  geom_polygon(data = UK,
               aes(x =long,
                   y= lat,
                   group=group),
               color="pink")+
  coord_map()+
  geom_point(data = cats_uk,
             aes(x = location_long,
                 y= location_lat,
                 color="where the cats were found"))+
  scale_x_continuous(limits = c(-6,-3)) + 
  scale_y_continuous(limits = c(50,51))

data("move_data", package = "moveVis") # move class object
# if your tracks are present as data.frames, see df2move() for conversion

# align move_data to a uniform time scale
m <- align_move(move_data, res = 4, unit = "mins")

# create spatial frames with a OpenStreetMap watercolour map
frames <- frames_spatial(m, path_colours = c("red", "green", "blue"),
                         map_service = "osm", map_type = "watercolor", alpha = 0.5) %>% 
  add_labels(x = "Longitude", y = "Latitude") %>% # add some customizations, such as axis labels
  add_northarrow() %>% 
  add_scalebar() %>% 
  add_timestamps(type = "label") %>% 
  add_progress()
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
# preview one of the frames, e.g. the 100th frame
frames[[100]] 

# animate frames
animate_frames(frames, out_file = here("Mac", "output", "moveVis.gif"), overwrite = TRUE)
## Rendering animation...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
data("move_data")

unique(timestamps(move_data))
##   [1] "2018-05-15 09:59:59 UTC" "2018-05-15 10:04:01 UTC"
##   [3] "2018-05-15 10:08:02 UTC" "2018-05-15 10:12:04 UTC"
##   [5] "2018-05-15 10:16:05 UTC" "2018-05-15 10:20:06 UTC"
##   [7] "2018-05-15 10:24:07 UTC" "2018-05-15 10:28:07 UTC"
##   [9] "2018-05-15 10:32:10 UTC" "2018-05-15 10:36:12 UTC"
##  [11] "2018-05-15 10:40:11 UTC" "2018-05-15 10:44:14 UTC"
##  [13] "2018-05-15 10:48:13 UTC" "2018-05-15 10:52:16 UTC"
##  [15] "2018-05-15 10:56:17 UTC" "2018-05-15 11:00:18 UTC"
##  [17] "2018-05-15 11:04:20 UTC" "2018-05-15 11:08:20 UTC"
##  [19] "2018-05-15 11:12:21 UTC" "2018-05-15 11:16:22 UTC"
##  [21] "2018-05-15 11:20:24 UTC" "2018-05-15 11:24:26 UTC"
##  [23] "2018-05-15 11:28:25 UTC" "2018-05-15 11:32:29 UTC"
##  [25] "2018-05-15 11:36:30 UTC" "2018-05-15 11:40:31 UTC"
##  [27] "2018-05-15 11:44:31 UTC" "2018-05-15 11:48:34 UTC"
##  [29] "2018-05-15 11:52:35 UTC" "2018-05-15 11:56:39 UTC"
##  [31] "2018-05-15 12:00:38 UTC" "2018-05-15 12:04:38 UTC"
##  [33] "2018-05-15 12:08:41 UTC" "2018-05-15 12:12:43 UTC"
##  [35] "2018-05-15 12:16:43 UTC" "2018-05-15 12:20:44 UTC"
##  [37] "2018-05-15 12:24:45 UTC" "2018-05-15 12:28:44 UTC"
##  [39] "2018-05-15 12:32:48 UTC" "2018-05-15 12:36:48 UTC"
##  [41] "2018-05-15 12:40:50 UTC" "2018-05-15 12:44:51 UTC"
##  [43] "2018-05-15 12:48:53 UTC" "2018-05-15 12:52:53 UTC"
##  [45] "2018-05-15 12:56:55 UTC" "2018-05-15 13:00:56 UTC"
##  [47] "2018-05-15 13:04:58 UTC" "2018-05-15 13:08:59 UTC"
##  [49] "2018-05-15 13:13:00 UTC" "2018-05-15 13:17:01 UTC"
##  [51] "2018-05-15 13:21:03 UTC" "2018-05-15 13:25:02 UTC"
##  [53] "2018-05-15 13:29:03 UTC" "2018-05-15 13:33:05 UTC"
##  [55] "2018-05-15 13:37:07 UTC" "2018-05-15 13:41:07 UTC"
##  [57] "2018-05-15 13:45:11 UTC" "2018-05-15 13:49:12 UTC"
##  [59] "2018-05-15 13:53:13 UTC" "2018-05-15 13:57:15 UTC"
##  [61] "2018-05-15 14:01:15 UTC" "2018-05-15 14:05:17 UTC"
##  [63] "2018-05-15 14:09:18 UTC" "2018-05-15 14:13:19 UTC"
##  [65] "2018-05-15 14:17:19 UTC" "2018-05-15 14:21:21 UTC"
##  [67] "2018-05-15 14:25:22 UTC" "2018-05-15 14:29:25 UTC"
##  [69] "2018-05-15 14:33:26 UTC" "2018-05-15 14:37:25 UTC"
##  [71] "2018-05-15 14:41:27 UTC" "2018-05-15 14:45:29 UTC"
##  [73] "2018-05-15 14:49:30 UTC" "2018-05-15 14:53:31 UTC"
##  [75] "2018-05-15 14:57:32 UTC" "2018-05-15 15:01:33 UTC"
##  [77] "2018-05-15 15:05:35 UTC" "2018-05-15 15:09:38 UTC"
##  [79] "2018-05-15 15:13:36 UTC" "2018-05-15 15:17:37 UTC"
##  [81] "2018-05-15 15:21:39 UTC" "2018-05-15 15:25:42 UTC"
##  [83] "2018-05-15 15:29:43 UTC" "2018-05-15 15:33:46 UTC"
##  [85] "2018-05-15 15:37:46 UTC" "2018-05-15 15:41:47 UTC"
##  [87] "2018-05-15 15:45:48 UTC" "2018-05-15 15:49:49 UTC"
##  [89] "2018-05-15 15:53:52 UTC" "2018-05-15 15:57:51 UTC"
##  [91] "2018-05-15 16:01:54 UTC" "2018-05-15 16:05:52 UTC"
##  [93] "2018-05-15 16:09:55 UTC" "2018-05-15 16:13:56 UTC"
##  [95] "2018-05-15 16:17:57 UTC" "2018-05-15 16:21:58 UTC"
##  [97] "2018-05-15 16:26:02 UTC" "2018-05-15 16:30:02 UTC"
##  [99] "2018-05-15 16:34:03 UTC" "2018-05-15 16:38:03 UTC"
## [101] "2018-05-15 16:42:06 UTC" "2018-05-15 16:46:06 UTC"
## [103] "2018-05-15 16:50:08 UTC" "2018-05-15 16:54:11 UTC"
## [105] "2018-05-15 16:58:10 UTC" "2018-05-15 17:02:11 UTC"
## [107] "2018-05-15 17:06:13 UTC" "2018-05-15 17:10:13 UTC"
## [109] "2018-05-15 17:14:17 UTC" "2018-05-15 17:18:17 UTC"
## [111] "2018-05-15 17:22:18 UTC" "2018-05-15 17:26:18 UTC"
## [113] "2018-05-15 17:30:20 UTC" "2018-05-15 17:34:22 UTC"
## [115] "2018-05-15 17:38:24 UTC" "2018-05-15 17:42:25 UTC"
## [117] "2018-05-15 17:46:27 UTC" "2018-05-15 17:50:27 UTC"
## [119] "2018-05-15 17:54:27 UTC" "2018-05-15 17:58:30 UTC"
## [121] "2018-05-15 18:02:30 UTC" "2018-05-15 18:06:32 UTC"
## [123] "2018-05-15 18:10:34 UTC" "2018-05-15 18:14:36 UTC"
## [125] "2018-05-15 18:18:36 UTC" "2018-05-15 18:22:37 UTC"
## [127] "2018-05-15 18:26:36 UTC" "2018-05-15 18:30:40 UTC"
## [129] "2018-05-15 18:34:41 UTC" "2018-05-15 18:38:42 UTC"
## [131] "2018-05-15 18:42:44 UTC" "2018-05-15 18:46:46 UTC"
## [133] "2018-05-15 18:50:45 UTC" "2018-05-15 18:54:47 UTC"
## [135] "2018-05-15 18:58:48 UTC" "2018-05-15 19:02:49 UTC"
## [137] "2018-05-15 19:06:51 UTC" "2018-05-15 19:10:52 UTC"
## [139] "2018-05-15 19:14:53 UTC" "2018-05-15 19:18:55 UTC"
## [141] "2018-05-15 19:22:55 UTC" "2018-05-15 19:26:57 UTC"
## [143] "2018-05-15 19:30:57 UTC" "2018-05-15 19:34:59 UTC"
## [145] "2018-05-15 08:00:00 UTC" "2018-05-15 08:04:00 UTC"
## [147] "2018-05-15 08:08:02 UTC" "2018-05-15 08:12:01 UTC"
## [149] "2018-05-15 08:16:03 UTC" "2018-05-15 08:20:07 UTC"
## [151] "2018-05-15 08:24:11 UTC" "2018-05-15 08:28:10 UTC"
## [153] "2018-05-15 08:32:11 UTC" "2018-05-15 08:36:12 UTC"
## [155] "2018-05-15 08:40:14 UTC" "2018-05-15 08:44:14 UTC"
## [157] "2018-05-15 08:48:19 UTC" "2018-05-15 08:52:19 UTC"
## [159] "2018-05-15 08:56:21 UTC" "2018-05-15 09:00:23 UTC"
## [161] "2018-05-15 09:04:26 UTC" "2018-05-15 09:08:25 UTC"
## [163] "2018-05-15 09:12:28 UTC" "2018-05-15 09:16:28 UTC"
## [165] "2018-05-15 09:20:31 UTC" "2018-05-15 09:24:31 UTC"
## [167] "2018-05-15 09:28:32 UTC" "2018-05-15 09:32:33 UTC"
## [169] "2018-05-15 09:36:34 UTC" "2018-05-15 09:40:37 UTC"
## [171] "2018-05-15 09:44:42 UTC" "2018-05-15 09:48:41 UTC"
## [173] "2018-05-15 09:52:41 UTC" "2018-05-15 09:56:44 UTC"
## [175] "2018-05-15 10:00:45 UTC" "2018-05-15 10:04:46 UTC"
## [177] "2018-05-15 10:08:48 UTC" "2018-05-15 10:12:49 UTC"
## [179] "2018-05-15 10:16:53 UTC" "2018-05-15 10:20:53 UTC"
## [181] "2018-05-15 10:24:53 UTC" "2018-05-15 10:28:56 UTC"
## [183] "2018-05-15 10:32:57 UTC" "2018-05-15 10:36:58 UTC"
## [185] "2018-05-15 10:41:00 UTC" "2018-05-15 10:45:03 UTC"
## [187] "2018-05-15 10:49:02 UTC" "2018-05-15 10:53:05 UTC"
## [189] "2018-05-15 10:57:07 UTC" "2018-05-15 11:01:08 UTC"
## [191] "2018-05-15 11:05:07 UTC" "2018-05-15 11:09:11 UTC"
## [193] "2018-05-15 11:13:12 UTC" "2018-05-15 11:17:15 UTC"
## [195] "2018-05-15 11:21:16 UTC" "2018-05-15 11:25:15 UTC"
## [197] "2018-05-15 11:29:16 UTC" "2018-05-15 11:33:20 UTC"
## [199] "2018-05-15 11:37:22 UTC" "2018-05-15 11:41:22 UTC"
## [201] "2018-05-15 11:45:25 UTC" "2018-05-15 11:49:24 UTC"
## [203] "2018-05-15 11:53:27 UTC" "2018-05-15 11:57:28 UTC"
## [205] "2018-05-15 12:01:29 UTC" "2018-05-15 12:05:30 UTC"
## [207] "2018-05-15 12:09:34 UTC" "2018-05-15 12:13:33 UTC"
## [209] "2018-05-15 12:17:36 UTC" "2018-05-15 12:21:36 UTC"
## [211] "2018-05-15 12:25:40 UTC" "2018-05-15 12:29:40 UTC"
## [213] "2018-05-15 12:33:42 UTC" "2018-05-15 12:37:44 UTC"
## [215] "2018-05-15 12:41:46 UTC" "2018-05-15 12:45:48 UTC"
## [217] "2018-05-15 12:49:48 UTC" "2018-05-15 12:53:48 UTC"
## [219] "2018-05-15 12:57:51 UTC" "2018-05-15 13:01:52 UTC"
## [221] "2018-05-15 13:05:53 UTC" "2018-05-15 13:09:55 UTC"
## [223] "2018-05-15 13:13:57 UTC" "2018-05-15 13:18:00 UTC"
## [225] "2018-05-15 13:22:00 UTC" "2018-05-15 13:26:03 UTC"
## [227] "2018-05-15 13:30:04 UTC" "2018-05-15 13:34:07 UTC"
## [229] "2018-05-15 13:38:04 UTC" "2018-05-15 13:42:08 UTC"
## [231] "2018-05-15 13:46:10 UTC" "2018-05-15 13:50:11 UTC"
## [233] "2018-05-15 13:54:11 UTC" "2018-05-15 13:58:15 UTC"
## [235] "2018-05-15 14:02:15 UTC" "2018-05-15 14:06:16 UTC"
## [237] "2018-05-15 14:10:17 UTC" "2018-05-15 14:14:21 UTC"
## [239] "2018-05-15 14:18:19 UTC" "2018-05-15 14:22:24 UTC"
## [241] "2018-05-15 14:26:23 UTC" "2018-05-15 14:30:27 UTC"
## [243] "2018-05-15 14:34:28 UTC" "2018-05-15 14:38:29 UTC"
## [245] "2018-05-15 14:42:29 UTC" "2018-05-15 14:46:30 UTC"
## [247] "2018-05-15 14:50:34 UTC" "2018-05-15 14:54:35 UTC"
## [249] "2018-05-15 14:58:35 UTC" "2018-05-15 15:02:38 UTC"
## [251] "2018-05-15 15:06:38 UTC" "2018-05-15 15:10:42 UTC"
## [253] "2018-05-15 15:14:41 UTC" "2018-05-15 15:18:44 UTC"
## [255] "2018-05-15 15:22:44 UTC" "2018-05-15 15:26:48 UTC"
## [257] "2018-05-15 15:30:49 UTC" "2018-05-15 15:34:51 UTC"
## [259] "2018-05-15 15:38:52 UTC" "2018-05-15 15:42:54 UTC"
## [261] "2018-05-15 15:46:54 UTC" "2018-05-15 15:50:55 UTC"
## [263] "2018-05-15 15:54:59 UTC" "2018-05-15 15:59:00 UTC"
## [265] "2018-05-15 16:03:00 UTC" "2018-05-15 16:07:01 UTC"
## [267] "2018-05-15 16:11:04 UTC" "2018-05-15 16:15:04 UTC"
## [269] "2018-05-15 16:19:06 UTC" "2018-05-15 16:23:09 UTC"
## [271] "2018-05-15 16:27:11 UTC" "2018-05-15 16:31:11 UTC"
## [273] "2018-05-15 16:35:12 UTC" "2018-05-15 16:39:14 UTC"
## [275] "2018-05-15 16:43:17 UTC" "2018-05-15 16:47:16 UTC"
## [277] "2018-05-15 16:51:20 UTC" "2018-05-15 16:55:20 UTC"
## [279] "2018-05-15 16:59:23 UTC" "2018-05-15 17:03:24 UTC"
## [281] "2018-05-15 17:07:26 UTC" "2018-05-15 17:11:26 UTC"
## [283] "2018-05-15 17:15:29 UTC" "2018-05-15 17:19:27 UTC"
## [285] "2018-05-15 17:23:32 UTC" "2018-05-15 17:27:33 UTC"
## [287] "2018-05-15 17:31:34 UTC" "2018-05-15 17:35:35 UTC"
## [289] "2018-05-15 17:39:36 UTC" "2018-05-15 17:43:37 UTC"
## [291] "2018-05-15 17:47:39 UTC" "2018-05-15 17:51:42 UTC"
## [293] "2018-05-15 17:55:42 UTC" "2018-05-15 17:59:46 UTC"
## [295] "2018-05-15 18:03:48 UTC" "2018-05-15 18:07:46 UTC"
## [297] "2018-05-15 18:11:48 UTC" "2018-05-15 18:15:50 UTC"
## [299] "2018-05-15 18:19:52 UTC" "2018-05-15 18:23:54 UTC"
## [301] "2018-05-15 18:27:55 UTC" "2018-05-15 18:31:57 UTC"
## [303] "2018-05-15 18:35:58 UTC" "2018-05-15 18:40:00 UTC"
## [305] "2018-05-15 06:59:59 UTC" "2018-05-15 07:04:00 UTC"
## [307] "2018-05-15 07:08:04 UTC" "2018-05-15 07:12:02 UTC"
## [309] "2018-05-15 07:16:05 UTC" "2018-05-15 07:20:05 UTC"
## [311] "2018-05-15 07:24:06 UTC" "2018-05-15 07:28:06 UTC"
## [313] "2018-05-15 07:32:09 UTC" "2018-05-15 07:36:10 UTC"
## [315] "2018-05-15 07:40:10 UTC" "2018-05-15 07:44:13 UTC"
## [317] "2018-05-15 07:48:14 UTC" "2018-05-15 07:52:17 UTC"
## [319] "2018-05-15 07:56:17 UTC" "2018-05-15 08:00:18 UTC"
## [321] "2018-05-15 08:04:19 UTC" "2018-05-15 08:08:18 UTC"
## [323] "2018-05-15 08:12:20 UTC" "2018-05-15 08:16:20 UTC"
## [325] "2018-05-15 08:20:25 UTC" "2018-05-15 08:24:24 UTC"
## [327] "2018-05-15 08:28:23 UTC" "2018-05-15 08:32:26 UTC"
## [329] "2018-05-15 08:36:28 UTC" "2018-05-15 08:40:30 UTC"
## [331] "2018-05-15 08:44:31 UTC" "2018-05-15 08:48:32 UTC"
## [333] "2018-05-15 08:52:33 UTC" "2018-05-15 08:56:34 UTC"
## [335] "2018-05-15 09:00:35 UTC" "2018-05-15 09:04:36 UTC"
## [337] "2018-05-15 09:08:37 UTC" "2018-05-15 09:12:40 UTC"
## [339] "2018-05-15 09:16:40 UTC" "2018-05-15 09:20:40 UTC"
## [341] "2018-05-15 09:24:43 UTC" "2018-05-15 09:28:43 UTC"
## [343] "2018-05-15 09:32:43 UTC" "2018-05-15 09:36:45 UTC"
## [345] "2018-05-15 09:40:47 UTC" "2018-05-15 09:44:47 UTC"
## [347] "2018-05-15 09:48:49 UTC" "2018-05-15 09:52:50 UTC"
## [349] "2018-05-15 09:56:50 UTC" "2018-05-15 10:00:53 UTC"
## [351] "2018-05-15 10:04:55 UTC" "2018-05-15 10:08:54 UTC"
## [353] "2018-05-15 10:12:56 UTC" "2018-05-15 10:16:58 UTC"
## [355] "2018-05-15 10:20:57 UTC" "2018-05-15 10:25:01 UTC"
## [357] "2018-05-15 10:29:00 UTC" "2018-05-15 10:33:02 UTC"
## [359] "2018-05-15 10:37:04 UTC" "2018-05-15 10:41:04 UTC"
## [361] "2018-05-15 10:45:06 UTC" "2018-05-15 10:49:06 UTC"
## [363] "2018-05-15 10:53:08 UTC" "2018-05-15 10:57:08 UTC"
## [365] "2018-05-15 11:01:10 UTC" "2018-05-15 11:05:11 UTC"
## [367] "2018-05-15 11:09:13 UTC" "2018-05-15 11:13:13 UTC"
## [369] "2018-05-15 11:17:14 UTC" "2018-05-15 11:21:16 UTC"
## [371] "2018-05-15 11:25:20 UTC" "2018-05-15 11:29:17 UTC"
## [373] "2018-05-15 11:33:21 UTC" "2018-05-15 11:37:20 UTC"
## [375] "2018-05-15 11:41:22 UTC" "2018-05-15 11:45:20 UTC"
## [377] "2018-05-15 11:49:25 UTC" "2018-05-15 11:53:24 UTC"
## [379] "2018-05-15 11:57:26 UTC" "2018-05-15 12:01:27 UTC"
## [381] "2018-05-15 12:05:30 UTC" "2018-05-15 12:09:30 UTC"
## [383] "2018-05-15 12:13:30 UTC" "2018-05-15 12:17:31 UTC"
## [385] "2018-05-15 12:21:34 UTC" "2018-05-15 12:25:36 UTC"
## [387] "2018-05-15 12:29:36 UTC" "2018-05-15 12:33:37 UTC"
## [389] "2018-05-15 12:37:38 UTC" "2018-05-15 12:41:40 UTC"
## [391] "2018-05-15 12:45:42 UTC" "2018-05-15 12:49:42 UTC"
## [393] "2018-05-15 12:53:44 UTC" "2018-05-15 12:57:44 UTC"
## [395] "2018-05-15 13:01:46 UTC" "2018-05-15 13:05:45 UTC"
## [397] "2018-05-15 13:09:49 UTC" "2018-05-15 13:13:48 UTC"
## [399] "2018-05-15 13:17:50 UTC" "2018-05-15 13:21:50 UTC"
## [401] "2018-05-15 13:25:51 UTC" "2018-05-15 13:29:54 UTC"
## [403] "2018-05-15 13:33:55 UTC" "2018-05-15 13:37:55 UTC"
## [405] "2018-05-15 13:41:56 UTC" "2018-05-15 13:45:58 UTC"
## [407] "2018-05-15 13:50:00 UTC" "2018-05-15 13:54:01 UTC"
## [409] "2018-05-15 13:58:02 UTC" "2018-05-15 14:02:05 UTC"
## [411] "2018-05-15 14:06:04 UTC" "2018-05-15 14:10:06 UTC"
## [413] "2018-05-15 14:14:08 UTC" "2018-05-15 14:18:07 UTC"
## [415] "2018-05-15 14:22:09 UTC" "2018-05-15 14:26:08 UTC"
## [417] "2018-05-15 14:30:11 UTC" "2018-05-15 14:34:13 UTC"
## [419] "2018-05-15 14:38:13 UTC" "2018-05-15 14:42:13 UTC"
## [421] "2018-05-15 14:46:15 UTC" "2018-05-15 14:50:18 UTC"
## [423] "2018-05-15 14:54:17 UTC" "2018-05-15 14:58:18 UTC"
## [425] "2018-05-15 15:02:19 UTC" "2018-05-15 15:06:21 UTC"
## [427] "2018-05-15 15:10:23 UTC" "2018-05-15 15:14:24 UTC"
## [429] "2018-05-15 15:18:26 UTC" "2018-05-15 15:22:25 UTC"
## [431] "2018-05-15 15:26:28 UTC" "2018-05-15 15:30:29 UTC"
## [433] "2018-05-15 15:34:31 UTC" "2018-05-15 15:38:33 UTC"
## [435] "2018-05-15 15:42:33 UTC" "2018-05-15 15:46:35 UTC"
## [437] "2018-05-15 15:50:37 UTC" "2018-05-15 15:54:37 UTC"
## [439] "2018-05-15 15:58:38 UTC" "2018-05-15 16:02:38 UTC"
## [441] "2018-05-15 16:06:41 UTC" "2018-05-15 16:10:40 UTC"
## [443] "2018-05-15 16:14:41 UTC" "2018-05-15 16:18:45 UTC"
## [445] "2018-05-15 16:22:45 UTC" "2018-05-15 16:26:45 UTC"
## [447] "2018-05-15 16:30:47 UTC" "2018-05-15 16:34:47 UTC"
## [449] "2018-05-15 16:38:50 UTC" "2018-05-15 16:42:49 UTC"
## [451] "2018-05-15 16:46:51 UTC" "2018-05-15 16:50:54 UTC"
## [453] "2018-05-15 16:54:53 UTC" "2018-05-15 16:58:56 UTC"
## [455] "2018-05-15 17:02:56 UTC" "2018-05-15 17:06:56 UTC"
## [457] "2018-05-15 17:11:00 UTC" "2018-05-15 17:15:00 UTC"
timeLag(move_data, unit = "mins")
## $T246a
##   [1] 4.026804 4.020242 4.033803 4.019960 4.018001 4.008648 4.001440 4.044464
##   [9] 4.037841 3.979544 4.049861 3.994834 4.050077 4.013051 4.005723 4.041303
##  [17] 4.005966 4.013521 4.016696 4.029500 4.027778 3.991594 4.069343 4.010892
##  [25] 4.019608 4.001466 4.043299 4.018088 4.068987 3.985547 4.003711 4.041356
##  [33] 4.034072 3.993954 4.017263 4.021471 3.980398 4.067171 4.002660 4.030485
##  [41] 4.022247 4.023201 4.014340 4.029156 4.019652 4.021522 4.018450 4.016295
##  [49] 4.028307 4.025756 3.991190 4.016949 4.020471 4.035217 4.011960 4.064258
##  [57] 4.003678 4.029462 4.024934 4.004204 4.034832 4.010546 4.020432 3.995162
##  [65] 4.045498 4.007405 4.047301 4.017385 3.981213 4.031753 4.044128 4.006074
##  [73] 4.017613 4.018109 4.019771 4.041813 4.036707 3.975788 4.020581 4.029181
##  [81] 4.043636 4.022229 4.042998 4.007305 4.008419 4.018025 4.018851 4.060169
##  [89] 3.984317 4.044567 3.970583 4.044420 4.014229 4.018292 4.013241 4.066164
##  [97] 4.000081 4.012670 4.004306 4.052209 3.999826 4.038933 4.042604 3.993045
## [105] 4.010371 4.032225 4.006565 4.053304 4.010424 4.019569 3.996211 4.036456
## [113] 4.027707 4.027966 4.018130 4.039227 3.991538 4.004488 4.046189 4.012623
## [121] 4.030965 4.021609 4.045310 4.001711 4.013944 3.977812 4.072268 4.005580
## [129] 4.025423 4.032235 4.036351 3.976414 4.036653 4.012541 4.028724 4.029501
## [137] 4.007711 4.016169 4.036119 4.005714 4.032170 3.994458 4.038348
## 
## $T342g
##   [1] 4.005474 4.028601 3.988200 4.033574 4.058253 4.069802 3.988183 4.020624
##   [9] 4.018717 4.028759 4.001710 4.070962 4.008206 4.029677 4.033729 4.045538
##  [17] 3.984449 4.050699 4.011958 4.045875 3.995567 4.012957 4.016786 4.025219
##  [25] 4.051561 4.071146 3.982788 4.012599 4.045710 4.011356 4.024995 4.032492
##  [33] 4.015105 4.058554 4.001044 4.009757 4.044786 4.015892 4.019787 4.027496
##  [41] 4.061384 3.979984 4.046228 4.025989 4.021937 3.992011 4.068724 4.010106
##  [49] 4.041095 4.023784 3.984511 4.023900 4.066413 4.024494 4.002370 4.055499
##  [57] 3.980588 4.040458 4.024212 4.020081 4.007725 4.070611 3.980436 4.050406
##  [65] 4.005121 4.063900 3.991672 4.046081 4.024527 4.034306 4.028726 4.010957
##  [73] 4.003871 4.046586 4.005026 4.020193 4.039844 4.030662 4.051942 4.006238
##  [81] 4.042405 4.009237 4.048949 3.963695 4.064061 4.029737 4.018588 3.996469
##  [89] 4.073824 4.002621 4.007381 4.013380 4.073776 3.957034 4.085930 3.990683
##  [97] 4.063103 4.021722 4.010220 4.006935 4.017701 4.069630 4.016418 3.985347
## [105] 4.054513 3.996659 4.070250 3.987356 4.051103 4.003552 4.053488 4.027775
## [113] 4.025835 4.021575 4.027284 4.008247 4.007098 4.072022 4.009731 4.003269
## [121] 4.028402 4.036496 4.012118 4.022167 4.060122 4.027990 3.994944 4.019101
## [129] 4.031674 4.057988 3.985364 4.058462 3.997625 4.048030 4.018077 4.042229
## [137] 4.000358 4.039974 3.980391 4.067139 4.022422 4.024503 4.007118 4.024666
## [145] 4.004565 4.048349 4.037585 3.999215 4.065408 4.044797 3.964266 4.032778
## [153] 4.039191 4.030436 4.025524 4.019996 4.034183 4.018847 4.023462
## 
## $T932u
##   [1] 4.008016 4.077225 3.964724 4.045927 3.999656 4.025746 4.001192 4.047010
##   [9] 4.008469 4.010786 4.047231 4.007570 4.047092 4.000716 4.015408 4.023610
##  [17] 3.979065 4.040870 3.995234 4.078098 3.990949 3.979683 4.053421 4.027651
##  [25] 4.034097 4.022051 4.011951 4.014157 4.030334 4.007267 4.018896 4.010764
##  [33] 4.056347 3.994577 4.004655 4.043019 4.010336 3.996210 4.038642 4.036623
##  [41] 3.999231 4.032063 4.016084 3.989902 4.050682 4.031036 3.984102 4.038394
##  [49] 4.041660 3.983423 4.055294 3.985186 4.036690 4.033314 4.000711 4.028686
##  [57] 4.007576 4.028761 4.004879 4.031421 4.021387 4.033586 3.993885 4.021282
##  [65] 4.026157 4.062422 3.958273 4.057782 3.994601 4.028302 3.973898 4.077948
##  [73] 3.985157 4.034623 4.014901 4.041895 4.001702 3.999473 4.024090 4.040909
##  [81] 4.045611 3.996142 4.013757 4.018534 4.027307 4.042709 4.000184 4.024553
##  [89] 4.002114 4.033754 3.977624 4.078145 3.978268 4.032743 3.997349 4.013401
##  [97] 4.055385 4.013273 4.008470 4.003977 4.047503 4.029025 4.017297 4.018381
## [105] 4.040368 3.980570 4.039489 4.028714 3.992487 4.036672 3.980581 4.043924
## [113] 4.038958 4.002731 3.994624 4.041393 4.040911 3.987625 4.017798 4.017734
## [121] 4.029737 4.033449 4.014429 4.036920 3.978241 4.055590 4.010322 4.040822
## [129] 4.035243 3.996384 4.022388 4.036652 3.996610 4.018799 4.001003 4.062412
## [137] 3.975626 4.020661 4.058001 4.001867 3.998504 4.037375 4.001291 4.047661
## [145] 3.983014 4.030532 4.047968 3.995521 4.043829 3.997729 4.005525 4.055681
## [153] 4.015771
move_data <- align_move(move_data, res = 4, unit = "mins")

get_maptypes()
## $osm
##  [1] "streets"      "streets_de"   "streets_fr"   "humanitarian" "topographic" 
##  [6] "roads"        "hydda"        "hydda_base"   "hike"         "grayscale"   
## [11] "no_labels"    "watercolor"   "toner"        "toner_bg"     "toner_lite"  
## [16] "terrain"      "terrain_bg"   "mtb"         
## 
## $carto
##  [1] "light"                "light_no_labels"      "light_only_labels"   
##  [4] "dark"                 "dark_no_labels"       "dark_only_labels"    
##  [7] "voyager"              "voyager_no_labels"    "voyager_only_labels" 
## [10] "voyager_labels_under"
## 
## $mapbox
##  [1] "satellite"     "streets"       "streets_basic" "hybrid"       
##  [5] "light"         "dark"          "high_contrast" "outdoors"     
##  [9] "hike"          "wheatpaste"    "pencil"        "comic"        
## [13] "pirates"       "emerald"
# Example 1

frames <- frames_spatial(move_data, path_colours = c("red", "green", "blue"),
                         map_service = "osm", map_type = "streets", alpha = 0.5)
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
length(frames) # number of frames
## [1] 180
frames[[100]] # display one of the frames

animate_frames(frames, out_file = here("Mac", "output", "example_1.gif"), overwrite = TRUE)
## Rendering animation...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
# Example 2

frames <- frames_spatial(move_data, path_colours = c("red", "green", "blue"),
                         map_service = "osm", map_type = "streets", map_res = 0.8)
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
frames[[100]] # display one of the frames

move_data <- sp::spTransform(move_data, crs("+init=epsg:3857"))

frames <- frames_spatial(move_data, path_colours = c("red", "green", "blue"),
                         map_service = "osm", map_type = "streets", map_res = 0.8, equidistant = FALSE)
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
frames[[100]] # display one of the frames

animate_frames(frames, out_file = here("Mac", "output", "example_2.gif"), width = 700, height = 500, res = 80, overwrite = TRUE)
## Rendering animation...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
data("move_data")

# align movement tracks
move_data <- align_move(move_data, res = 4, unit = "mins")

# create frames
frames <- frames_spatial(move_data, path_colours = c("red", "green", "blue"),
                         map_service = "osm", map_type = "streets", alpha = 0.5) %>%
  # edit frames
  add_labels(x = "Longitude", y = "Latitude") %>% # add labels, e.g. axis labels
  add_progress() %>% # add a progress bar
  add_scalebar(height = 0.015) %>% # add a scale bar
  add_northarrow() %>% # add a north arrow
  add_timestamps(move_data, type = "label") # add timestamps
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
## Have a look at one of the frames:
frames[[100]]

data <- data.frame(x = c(8.917, 8.924, 8.924, 8.916, 8.917),
                   y = c(47.7678, 47.7675, 47.764, 47.7646, 47.7678))

# just customize a single frame and have a look at it
frame_test <- frames[[100]] + geom_path(aes(x = x, y = y), data = data,
                                        colour = "red", linetype = "dashed")
frame_test

# or customize all frames at once using add_gg:
frames = add_gg(frames, gg = expr(geom_path(aes(x = x, y = y), data = data,
                                  colour = "red", linetype = "dashed")), data = data)

frames <- add_text(frames, "Static feature", x = 8.9205, y = 47.7633,
                   colour = "black", size = 3)

## Have a look at one of the frames:
frames[[100]]

## create data.frame containing corner coordinates
data <- data.frame(x = c(8.96, 8.955, 8.959, 8.963, 8.968, 8.963, 8.96),
                   y = c(47.725, 47.728, 47.729, 47.728, 47.725, 47.723, 47.725))

## make a list from it by replicating it by the length of frames
data <- rep(list(data), length.out = length(frames))

## now alter the coordinates to make them shift
data <- lapply(data, function(x){
  y <- rnorm(nrow(x)-1, mean = 0.00001, sd = 0.0001) 
  x + c(y, y[1])
})

## draw each individual polygon to each frame
frames = add_gg(frames, gg = expr(geom_path(aes(x = x, y = y), data = data,
                                  colour = "black")), data = data)

## add a text label
frames <- add_text(frames, "Dynamic feature", x = 8.959, y = 47.7305,
                   colour = "black", size = 3)

## Have a look at one of the frames:
frames[[100]]

animate_frames(frames, out_file = here("Mac", "output", "example_3.gif"), overwrite = TRUE)
## Rendering animation...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
data("move_data")

# align movement to unique times and regular resolution
m <- align_move(move_data, res = 4, unit = "mins")

## assign some path colours by individual
m.list <- split(m) # split m into list by individual

m.list <- mapply(x = m.list, y = c("red", "green", "blue"), function(x, y){
  x$colour <- y
  return(x)
}) # add colour per individual

m <- moveStack(m.list) # putting it back together into a moveStack

# create frames with mapbox satellite basemap
frames <- frames_spatial(m, map_service = "osm", map_type = "watercolor")
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
# animate the first 100 frames as example
animate_frames(frames[1:100], out_file = here("Mac", "output", "example_4.gif"), overwrite = TRUE)
## Rendering animation...
## Approximated animation duration: ≈ 4s at 25 fps for 100 frames
# to not calculate a squared (enlarged) extent:
frames <- frames_spatial(m, map_service = "osm", map_type = "watercolor",
                         equidistant = FALSE)
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
ext <- extent(8.820289, 9.076893, 47.68715, 47.80863)

# set the ext argument
frames <- frames_spatial(m, map_service = "osm", map_type = "watercolor",
                         ext = ext, equidistant = FALSE) %>% 
  add_labels(x = "Longitude", y = "Latitude") %>% 
  add_northarrow(colour = "white", height = 0.08, position = "bottomleft") %>% 
  add_scalebar(colour = "white", height = 0.022, position = "bottomright", label_margin = 1.4) %>% 
  add_timestamps(m, type = "label")
## Checking temporal alignment...
## Processing movement data...
## Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames
## Retrieving and compositing basemap imagery...
## Assigning raster maps to frames...
## Creating frames...
# animate the first 100 frames as example
animate_frames(frames[1:100], out_file = here("Mac", "output", "example_5.gif"),
               height = 500, width = 800, res = 82, overwrite = TRUE)
## Rendering animation...
## Approximated animation duration: ≈ 4s at 25 fps for 100 frames